<script setup>
import { ref } from "vue"

const props = defineProps({
    title: {
        type: String,
        default: "详情"
    },
    isShowModal: {
        type: Boolean,
        default: false
    }
})

const emit = defineEmits(['closeModal'])

// 关闭
const closeModal = () => {
    emit('closeModal')
}


</script>

<template>
    <div class="yike-modal" :style="{ right: isShowModal ? '0px' : '-370px' }">
        <div v-if="isShowModal">
            <div class="modal-header">
                <span class="modal-name">{{ title }}</span>
                <span class="iconfont icon-guanbi" @click="closeModal"></span>
            </div>
            <slot></slot>
        </div>
    </div>
</template>

<style lang="less" scoped>
.yike-modal {
    width: 360px;
    height: 100%;
    box-sizing: border-box;
    box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    z-index: 99;
    position: fixed;
    top: 52px;
    padding: 20px;
    transition: all 0.3s;

    .modal-header {
        display: flex;
        justify-content: space-between;
        align-items: center;

        .modal-name {
            font-size: 16px;
            color: #202020;
            font-weight: 600;
        }

        .icon-guanbi {
            cursor: pointer;
            color: #5B5B5B;
        }
    }
}
</style>